package oop;

/**
 * @ClassName : Demo01
 * @Author : LV88VL
 * @Date: 2021/2/4 11:18
 * @Description : oop编程----值传递和引用传递
 */
public class Demo01 {
    //值传递和引用传递
    public static void main(String[] args) {
        //值传递
        int a=1;
        System.out.println("a的值为"+a);
         aa(a);
        System.out.println("a的值为"+a);
        //引用传递
        Person01 person = new Person01();
        System.out.println("年龄的值为"+person.age);
        aaa(person);
        System.out.println("年龄的值为"+person.age);
    }
    //值传递
    public static void aa(int a){
        a=10;
    }
    //引用传递
    static class Person01 {
        int age;
    }
    public static void aaa(Person01 person){
        person.age=12;
    }
}
